<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!-- public quote -->
<%@include file="/jsp/comm_css_include.jsp"%>
<!-- jqgrid-->
<link
	href="${basePath}/css/plugins/jqgriddemo/css/ui.jqgrid-bootstrap.min.css"
	rel="stylesheet" />
<!doctype html>
<html>
<head>
</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="iboxtitle">
			<span><i class="glyphicon glyphicon-map-marker"></i>贷后业务&gt;出险理赔</span>
		</div>
		<div class="ibox-content ibox-zxsearchqu">
			<div role="form" class="form-inline">
				<div class="form-group">
					<label class="sr-only">客户名：</label> <input type="text"
						placeholder="客户名" id="name" name="name" class="form-control">
				</div>
				<div class="form-group">
					<label class="sr-only">业务员：</label> <input type="text"
						placeholder="身份证号" id="cusNo" name="cusNo" class="form-control">
				</div>
				<button class="zhixcx" type="button" onclick="query();">执行查询</button>
			</div>
		</div>
		<div class="ibox-content">
			<div class="jqGrid_wrapper">
				<table id="table_list_1"></table>
				<div id="pager_list_1"></div>
			</div>
		</div>
	</div>


	<!-- public quote -->
	<%@include file="/jsp/comm_js_include.jsp"%>

	<!-- jqGrid -->
	<script type="text/javascript" charset="utf-8"
		src="${basePath}/js/plugins/jqgriddemo/js/jquery.jqGrid.min.js"></script>
	<script type="text/javascript" charset="utf-8"
		src="${basePath}/js/plugins/jqgriddemo/js/grid.locale-cn.min.js"></script>

	<!-- layerDate plugin javascript -->
	<script src="${basePath}/js/plugins/layer/laydate/laydate.js"></script>


	<!--
    	作者：zhangpp
    	时间：2017-04-06
    	描述：js
    -->
	<script type="text/javascript">
	    
	    var winWidth = $(window).width();
		var winHeight = $(window).height();
		
	    jQuery(function($) {  
	    	getData();
	    });
	    
	    var getData = function()
	    {
   	   	   winWidth = $(window).width();
   	   	   winHeight = $(window).height() / 2.5;
  		   var win = winWidth / 7 - 20;
  		
  	 	   $.jgrid.defaults.styleUI = 'Bootstrap';
  	 	   
		  jQuery("#table_list_1").jqGrid
		  ({
			url:'${basePath}/DhInsuranceCompensationController/selectMulitList',
	        datatype : "json",
	        colNames : [ '主键','业务id','客户id', '保险到期日', '剩余天数', '保险公司', '年度', '车辆','车价','业务员', '客户姓名', '身份证号码'],
	        colModel : [ 
	                     {name: 'replaceId', index: 'a.id', hidden:true},
	                     {name: 'busiId', index: 'a.busiId', hidden:true},
	                     {name: 'cusId', index: 'a.cusId', hidden:true},
	                     {name: 'dateEnd',index: 'a.dateEnd',width: win,align: "center"},
	                  	 {name: 'remainDays',index: 'remainDays',width: win,align: "center"},
	                  	 {name: 'companyInsurance',index: 'a.companyInsurance',width: win,align: "center"},
	               		 {name: 'year',index: 'a.year',width: win,align: "center"},
	            		 {name: 'cxname',index: 'b.cxname',width: win,align: "center"},
	            		 {name: 'price',index: 'b.price',width: win,align: "center"},
	            		 {name: 'salesmanName',index: 'S.name',width: win,align: "center"},
	            		 {name: 'name',index: 'c.name',width: win,align: "center"},
	            		 {name: 'cusNo',index: 'c.cusNo',width: win,align: "center"}
	                   ],
              mtype : "post",
              height: winHeight,
              autowidth: false,
              width:winWidth,  
              shrinkToFit: false,
              rowNum: 15,
	           rowList: [15, 30, 45],
              viewrecords: true,
              pager: "#pager_list_1",
              hidegrid: false,
              multiselect : false,
              altRows:true,
              altclass:'someClass',
              ondblClickRow:function(rowId,v,e)
              {
            	  var rowData = $("#table_list_1").jqGrid("getRowData", rowId);
            	  var busiId = rowData.busiId;
            	  var cusId = rowData.cusId;
            	  var name = rowData.name;
            	  window.location.href="compensationClaims.jsp?busiId="+busiId+"&cusId="+cusId+"&name="+name;
            	  /* window.location.href="${basePath}/YwBusinessViewController/ywBussinessDetail?id=" + id;       */      	  
              },
              jsonReader : {
            	  root:"result.rows",
            	  page: "result.page",
            	  total: "result.total",
            	  records: "result.records",
            	  repeatitems: false,
            	  id: "replaceId"
              },
              loadComplete:function(datas){
            	  if (datas.flag == "100100") {
                      layer.msg("查询成功!", {icon: 6, time: 1000});
                      return;
                  }
            	  if(datas.flag == '100802') {
    				  top.location.href = thisLoginUrl;
    				  return;
    			  }

            	  layer.msg(datas.message, {icon: 2});
              }
	      });
	    }	    
	    
	    window.onresize = function()
	    {
	    	$("#table_list_1").setGridWidth($(window).width()-80);
	    }
	    
	    var query = function(dayEnum)
	    {
	    	var postData = $("#table_list_1").jqGrid("getGridParam", "postData");
	    	var data = {};
	    	data.name = document.getElementById('name').value || '';
	    	data.cusNo = document.getElementById('cusNo').value || '';
	    	$.extend(postData, data);
	    	refresh();
	    }
	    
	    var refresh = function()
	    {
	    	$("#table_list_1").jqGrid("setGridParam", { search: true }).trigger("reloadGrid", [{ page: 1}]);
	    }
    </script>
</body>
</html>
